<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;

/**
 * 首页模板
 * 
 * @package Word Theme
 * @author cklx0719
 * @version 1.0.0
 */

$this->need('header.php');
?>

<div class="a4-content p-8 md:p-12">
    <!-- 文档标题 -->
    <div class="text-center mb-8">
        <h1 class="text-size-2 font-songti font-semibold">文章目录</h1>
        <div class="mt-2 text-gray-500 font-fangSong text-size-4">共 <?php echo $this->counterPage; ?> 篇文章</div>
    </div>
    
    <!-- Word 风格的目录 -->
    <div class="word-toc mt-8">
        <?php $count = 0; ?>
        <?php while($this->next()): $count++; ?>
            <div class="toc-item flex mb-3 items-baseline">
                <!-- 文章标题 -->
                <div class="toc-title">
                    <a href="<?php $this->permalink() ?>" class="font-fangSong text-size-3 hover:text-blue-600 no-underline flex items-center">
                        <span class="mr-2"><?php echo $count . '.'; ?></span>
                        <span><?php $this->title() ?></span>
                    </a>
                </div>
                
                <!-- 点线 -->
                <div class="toc-dots flex-grow mx-2 self-end border-b border-dotted border-gray-300"></div>
                
                <!-- 页码 -->
                <div class="toc-page text-right whitespace-nowrap">
                    <span class="font-fangSong text-gray-600 text-size-3"><?php echo $count; ?></span>
                </div>
            </div>
        <?php endwhile; ?>
    </div>
    
    <!-- 分页 -->
    <div class="mt-12 flex justify-between items-center">
        <?php $this->pageNav('上一页', '下一页', 1, '...', array('wrapTag' => 'div', 'wrapClass' => 'flex justify-between items-center w-full', 'itemTag' => '', 'textTag' => 'span', 'currentClass' => 'current', 'prevClass' => 'word-btn flex items-center gap-1 px-4 py-1 border border-gray-300 hover:bg-gray-50', 'nextClass' => 'word-btn flex items-center gap-1 px-4 py-1 border border-gray-300 hover:bg-gray-50')); ?>
        <span class="text-size-4 text-gray-700 font-fangSong">第 <?php echo $this->_currentPage; ?> 页 / 共 <?php echo ceil($this->getTotal() / $this->parameter->pageSize); ?> 页</span>
    </div>
</div>

<?php $this->need('footer.php'); ?>